<template>
    <div style="background-color: #ffffff">
        <main class="search-page__main">
            <div>
                <div class="stage-tabs--page-header el-tabs el-tabs--top">
                    <div class="el-tabs__header is-top">
                        <div class="el-tabs__nav-wrap is-top">
                            <div class="el-tabs__nav-scroll">
                                <div role="tablist" class="el-tabs__nav is-top" style="transform: translateX(0px);">
                                    <div class="el-tabs__active-bar is-top"
                                         style="width: 56px; transform: translateX(0px);"></div>
                                    <div id="tab-all" aria-controls="pane-all" role="tab" aria-selected="true"
                                         tabindex="0"
                                         class="el-tabs__item is-top is-active">全部作者
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div loading-insert-type="embed" loading-type="tips"
                     style="position: relative;">
                    <article class="author-cell" v-for="(author,index) in authors" :key="index">
                        <section class="stage-flex-container"
                                 style="justify-content: flex-start; align-items: stretch; align-self: auto; flex: 1 1 0%;">
                            <a href="" target="_self">
                                <div class="avatar-wrapper hoverable is-round"
                                     style="flex: 0 0 64px; width: 64px; height: 64px; margin-right: 15px; padding-bottom: 0px;">
                                    <section class="avatar-wrapper__img-wrapper"
                                             style="width: 64px; height: 64px; background: rgb(255, 255, 255);">
                                        <img :src="imgUrl+author.authorImg"
                                             class="avatar-wrapper__avatar border"
                                             style="width: 64px; height: 64px; border-color: rgb(236, 236, 236);"
                                        @click="gotoUser(author)">
                                    </section>
                                </div>
                            </a>
                            <section class="author-cell__infos-wrapper">
                                <section class="author-cell__infos-info-wrapper">
                                    <section class="stage-flex-container"
                                             style="justify-content: flex-start; align-items: stretch; align-self: stretch;">
                                        <section class="stage-flex-container"
                                                 style="justify-content: flex-start; align-items: center; align-self: auto; flex: 1 1 0%; width: 0px;">
                                            <a href="" class="author-cell__name" target="_self">
                                                {{author.username}}
                                            </a>
                                        </section>
                                    </section>
                                    <section class="author-cell__comment-schedule-wrapper">
                                        <section class="author-cell__comment-info stage-flex-container"
                                                 style="justify-content: flex-start; align-items: center; align-self: auto;">
                                            <span>185 条评价</span>
                                        </section>
                                    </section>
                                </section>
                                <button type="button"
                                        class="stage-button author-cell__approximate-button stage-button--primary stage-button--medium">
                                    <span>邀请</span>
                                </button>
                            </section>
                        </section>
                        <section class="artwork-box__wrapper author-cell__artworks">
                            <div v-for="(work,index) in author.worksInfos" :key="index" v-if="index < 5">
                                <div  v-if="work.workFileType === 1"
                                      class="author-cell__artwork-wrapper stage-imgstage-img__hover-shade"
                                      @click="workDetail(work)">
                                    <img class="stage-img__img is-hoverable is-bordered is-responsive" lazy="loaded" style="border-color: rgb(236, 236, 236); border-radius: 4px;" :src="imgUrl+work.workFilename"/>
                                </div>
                                <div v-else @click="workDetail(work)">
                                        <span style="margin: 0 10px 0 20px"
                                                class="author-cell__artwork-wrapper ">
                                            <video :poster="work.poster" :controls="true" class="video_fo"
                                                   :src="imgUrl+work.workFilename"></video>
                                        </span>

                                </div>
                            </div>


                        </section>
                    </article>


                </div>
            </div>
        </main>

    </div>
</template>

<script setup>
  import {getAllAuthors} from "@/assets/api/authorApi";
  import {getCurrentInstance, onBeforeMount, ref} from "vue";
  import {useRouter} from "vue-router";

  const router = useRouter();
  const imgUrl = getCurrentInstance()?.appContext.config.globalProperties.$imgUrl
  const authors = ref([]);
  const workInfo = ref({});
  const comments = ref([{user: {userImg: ''}}]);
  const comment = ref('');
  const centerDialogVisible = ref(false);


  const getAuthors = () => {
    getAllAuthors().then((res) => {
      authors.value = res.data.data;
    })
  };
  const workDetail = (work) => {
    router.push({path: '/workDetail', query: {id: work.workId}});
  };
  const gotoUser = (author) => {
    router.push({path: '/authorPage', query: {id: author.userId}})
  };

  onBeforeMount(() => {
    getAuthors();
  });
</script>

<style scoped>
    .search-page__main {
        margin-left: 12%;
        width: 1200px;
    }
    .stage-tabs--page-header {
        border-bottom: 1px solid #e6eaee;
        margin-bottom: 15px;
        width: 100%;
    }
    .stage-tabs--page-header .el-tabs__header {
        margin: 0 auto;
        width: 1200px;
    }
    .el-tabs__header {
        padding: 0;
        position: relative;
        margin: 0 0 15px;
    }
    .el-tabs__nav-wrap {
        overflow: hidden;
        margin-bottom: -1px;
        position: relative;
    }
    .el-tabs__nav-scroll {
        overflow: hidden;
    }
    .el-tabs__nav {
        white-space: nowrap;
        position: relative;
        float: left;
        z-index: 2;
    }
    .el-tabs__active-bar {
        position: absolute;
        bottom: 0;
        left: 0;
        height: 2px;
        background-color: #00a8e9;
        z-index: 1;
        list-style: none;
    }
    .el-tabs--bottom .el-tabs__item.is-bottom:last-child, .el-tabs--bottom .el-tabs__item.is-top:last-child, .el-tabs--top .el-tabs__item.is-bottom:last-child, .el-tabs--top .el-tabs__item.is-top:last-child {
        padding-right: 0;
    }
    .el-tabs--top .el-tabs__item.is-top:nth-child(2) {
        padding-left: 0;
    }
    .stage-tabs--page-header .el-tabs__item {
        height: 60px;
        line-height: 60px;
        padding: 0 37.5px;
    }
    .el-tabs__item.is-active {
        color: #00a8e9;
    }
    .el-tabs__item {
        padding: 0 20px;
        height: 40px;
        box-sizing: border-box;
        line-height: 40px;
        display: inline-block;
        list-style: none;
        font-size: 14px;
        font-weight: 500;
        color: #27282e;
        position: relative;
    }
    a {
        color: #00a8e9;
        transition: .5s;
        cursor: pointer;
        text-decoration: none;
    }
    .author-cell {
        background: #fff;
        padding: 30px 0;
        display: flex;
        align-items: flex-start;
    }
    .stage-flex-container {
        display: flex;
    }
    .avatar-wrapper {
        position: relative;
        overflow: hidden;
        margin-right: 10px;
        transition: .5s;
        box-sizing: content-box;
    }
    .avatar-wrapper.is-round .avatar-wrapper__img-wrapper, .avatar-wrapper.is-round img {
        border-radius: 100%;
    }
    .avatar-wrapper__img-wrapper {
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
    }
    .avatar-wrapper__avatar.border {
        border: 1px solid transparent;
    }
    .avatar-wrapper__avatar {
        width: 100%;
        opacity: 1;
    }
    .border {
        border-width: 1px;
    }
    .author-cell__infos-info-wrapper, .author-cell__infos-wrapper {
        display: flex;
        flex-direction: column;
    }
    .author-cell__infos-wrapper {
        width: 0;
        flex: 1;
        align-items: flex-start;
        margin-right: 15px;
    }
    .author-cell__name {
        font-size: 16px;
        font-weight: 500;
        margin-right: 5px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: #707070;
        transition: .5s;
        cursor: pointer;
    }
    .author-cell__comment-info {
        font-size: 12px;
        color: #adb3fb;
        margin-top: 5px;
    }
    .author-cell__approximate-button {
        margin-top: 10px;
    }
    .stage-button--primary {
        color: #fff;
        background-color: #00a8e9;
        border-color: #00a8e9;
    }
    .stage-button--medium {
        padding: 10px 24px;
        font-size: 14px;
        border-radius: 4px;
    }
    .stage-button {
        display: inline-block;
        line-height: 1;
        white-space: nowrap;
        cursor: pointer;
        border: 1px solid #dcdfe6;
        appearance: none;
        text-align: center;
        outline: none;
        transition: .1s;
        user-select: none;
        padding: 10px 24px;
        font-size: 14px;
        border-radius: 4px;
    }
    .author-cell__artworks {
        display: grid;
        gap: 15px;
        grid-template-columns: repeat(5, 178px);
    }
    .author-cell__artwork-wrapper {
        display: flex;
        flex: 1;
        align-items: center;
        justify-content: center;
    }
    .stage-img {
        position: relative;
    }
    img[lazy=loaded] {
        animation: fadeIn-data-v-3dd27e86 .8s;
    }

    .stage-img__img.is-hoverable {
        cursor: pointer;
    }

    .stage-img__img.is-responsive {
        max-width: 100%;
        display: flex;
        flex: none;
        margin: 0 auto;
        width: 950px;
    }

    .stage-img__img {
        display: block;
    }
    .video_fo{
         width: 179px;
         height: 116px;
     }
    .dialog {
        z-index: 1000;
    }

    .artwork-modal__modal {
        position: relative;
        width: 950px;
        height: auto;
        border-radius: 8px;
        margin: auto;
    }

    .modal-author {
        padding: 20px 30px;
        margin-bottom: 20px;
        border-radius: 4px;
        background: #fff;
        display: flex;
        justify-content: space-between;
    }

    .stage-flex-container {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
    }

    .avatar-wrapper {
        position: relative;
        overflow: hidden;
        margin-right: 10px;
        transition: .5s;
        box-sizing: content-box;
    }

    .avatar-wrapper__img-wrapper {
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
    }

    .avatar-wrapper.is-round .avatar-wrapper__img-wrapper, .avatar-wrapper.is-round img {
        border-radius: 100%;
    }

    .avatar-wrapper__avatar.border {
        border: 1px solid transparent;
    }

    .avatar-wrapper__avatar {
        width: 100%;
        opacity: 1;
    }

    .modal-author__author-info {
        display: flex;
        width: auto;
        flex: 0 0 auto;
        flex-direction: column;
        justify-content: center;
        color: #707070;
    }

    .modal-author__author-credit {
        margin-top: 5px;
        display: inline-block;
    }

    .el-rate {
        height: 20px;
        line-height: 1;
    }

    .el-rate__item {
        font-size: 0;
        vertical-align: middle;
    }

    .stage-flex-container {
        display: flex;
    }

    .modal-author__author-operator button {
        margin-left: 15px;
        width: 94px;
        height: 30px;
        padding: 4px 15px;
        border-radius: 20px;
        border: 1px solid transparent;
    }

    .stage-button--warning {
        color: #fff;
        background-color: #adb3fb;
        border-color: #9eb0fb;
    }

    .stage-button--small {
        padding: 7px 18px;
        font-size: 12px;
        border-radius: 4px;
    }

    .stage-button {
        display: inline-block;
        line-height: 1;
        white-space: nowrap;
        cursor: pointer;
        border: 1px solid #dcdfe6;
        appearance: none;
        text-align: center;
        outline: none;
        margin: 0;
        transition: .1s;
        user-select: none;
        padding: 10px 24px;
        font-size: 14px;
        border-radius: 4px;
    }

    a {
        text-decoration: none;
    }

    .author-p {
        color: #222222;
    }

    .artwork-modal__artwork-img {
        border-top-left-radius: 4px;
    }

    .artwork-modal__artwork-img-wrapper img {
        width: 100%;
        cursor: pointer;
        border-top-left-radius: 4px;
    }

    .artwork-modal__artwork {
        background: #fff;
        display: flex;
        flex-direction: column;
        border-radius: 4px;
        position: relative;
    }
    .artwork-modal__sidebar {
        padding: 20px 30px 30px;
        border-top: 1px solid #ececec;
    }

    .artwork-modal__copyright-tips {
        display: flex;
        justify-content: space-between;
        padding-bottom: 20px;
        border-bottom: 1px solid #ececec;
        margin-bottom: 20px;
        font-size: 12px;
        color: #9b9b9b;
    }

    .artwork-modal__created-at {
        padding-right: 10px;
        margin-right: 10px;
        position: relative;
    }
    .artwork-modal__tag-more-artwork-wrapper {
        display: flex;
        -ms-flex: 1;
        flex: 1;
        position: relative;
        flex-direction: column;
        align-items: stretch;
    }
    .stage-flex-container {
        display: flex;
    }

    .artwork-modal__sidebar-title {
        color: #9b9b9b;
        font-size: 14px;
        line-height: 14px;
        margin-bottom: 10px;
    }

    .artwork-modal ul {
        padding-left: 0;
        list-style: none;
    }

    .artwork-modal li {
        display: inline-block;
    }

    .category-tag {
        color: #222222;
        padding: 0px 10px;
        font-size: 12px;
        border: 1px solid #adb3fb;
        border-radius: 40px;
        margin: 5px 5px 5px 5px;
        transition: .5s;
        cursor: pointer;
    }

    /deep/ .el-dialog__headerbtn {
        position: fixed;
        top: 20px;
        right: 40px;
        padding: 0;
        background: 0 0;
        border: none;
        cursor: pointer;
        font-size: 60px;
        color: #222222;
    }

    .works-comment {
        margin-top: 14px;
        padding: 24px 28px;
        background-color: #fff;
        border-radius: 4px;
    }

    .comment-form {
        display: flex;
    }

    .clearfix {
        zoom: 1;
    }

    .comment-btn {
        cursor: pointer;
        width: 116px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        background: #adb3fb;
        border-radius: 0 4px 4px 0;
        color: #2d2d2d;
        font-size: 18px;
    }

    .comment-num {
        font-size: 16px;
        color: #1a1a1a;
        padding: 20px 0;
    }

    .comment-num span {
        color: #999;
        font-size: 14px;
    }

    .comment-li {
        display: flex;
        margin-bottom: 20px;
    }

    .user-avatar {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .c-face-img-con {
        display: inline-block;
        position: relative;
    }

    .c-face-img img {
        width: 100%;
        height: 100%;
    }

    .comment-wrap {
        flex: 1;
        margin-left: 20px;
        border-bottom: 1px solid #eee;
        padding-bottom: 20px;
    }

    .user-name {
        font-weight: 700;
        color: #333;
        font-size: 14px;
    }

    .user-content {
        margin-top: 8px;
        color: #666;
        font-size: 14px;
        word-break: break-all;
    }

    .comment-info {
        padding: 14px 0 0;
        color: #999;
        font-size: 12px;
        display: flex;
    }

    .comment-time {
        flex-grow: 1;
    }

    .like-num {
        cursor: pointer;
        position: relative;
        display: flex;
        align-items: center;
    }

    .like-num span {
        margin-bottom: 2px;
        display: inline-block;
    }

    .artwork-modal__operator {
        position: absolute;
        left: 100%;
        width: 80px;
        height: 80px;
        font-size: 14px;
        background: #fff;
        border-radius: 0 8px 8px 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        line-height: 1;
        color: #9b9b9b;
    }

    .artwork-modal__operator i {
        color: #d8d8d8;
        font-size: 32px;
        margin-bottom: 5px;
    }

    /deep/ .el-dialog {
        display: flex;
        flex: 1;
        background-color: transparent;
        box-shadow: unset;
        position: static;
        width: auto;
        border-radius: 4px;
    }

    /deep/ .el-dialog__header {
        padding: 30px 30px 10px;
    }

    /deep/ .el-dialog__body {
        justify-content: center;
        align-items: center;
        display: flex;
        flex: 1;
        padding: 20px 30px 30px;
        color: #4a4a4a;
        font-size: 14px;
        word-break: break-all;
    }






    /deep/ .el-dialog {
        display: flex;
        flex: 1;
        background-color: transparent;
        box-shadow: unset;
        position: static;
        width: auto;
        border-radius: 4px;
    }

    /deep/ .el-dialog__header {
        padding: 30px 30px 10px;
    }

    /deep/ .el-dialog__body {
        justify-content: center;
        align-items: center;
        display: flex;
        flex: 1;
        padding: 20px 30px 30px;
        color: #4a4a4a;
        font-size: 14px;
        word-break: break-all;
    }

    .dialog {
        z-index: 1000;
    }

    .artwork-modal__modal {
        position: relative;
        width: 950px;
        height: auto;
        border-radius: 8px;
        margin: auto;
    }

    .modal-author {
        padding: 20px 30px;
        margin-bottom: 20px;
        border-radius: 4px;
        background: #fff;
        display: flex;
        justify-content: space-between;
    }

    .stage-flex-container {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
    }

    .avatar-wrapper {
        position: relative;
        overflow: hidden;
        margin-right: 10px;
        transition: .5s;
        box-sizing: content-box;
    }

    .avatar-wrapper__img-wrapper {
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
    }

    .avatar-wrapper.is-round .avatar-wrapper__img-wrapper, .avatar-wrapper.is-round img {
        border-radius: 100%;
    }

    .avatar-wrapper__avatar.border {
        border: 1px solid transparent;
    }

    .avatar-wrapper__avatar {
        width: 100%;
        opacity: 1;
    }

    .modal-author__author-info {
        display: flex;
        width: auto;
        flex: 0 0 auto;
        flex-direction: column;
        justify-content: center;
        color: #707070;
    }

    .modal-author__author-credit {
        margin-top: 5px;
        display: inline-block;
    }

    .el-rate {
        height: 20px;
        line-height: 1;
    }

    .el-rate__item {
        font-size: 0;
        vertical-align: middle;
    }

    .stage-flex-container {
        display: flex;
    }

    .modal-author__author-operator button {
        margin-left: 15px;
        width: 94px;
        height: 30px;
        padding: 4px 15px;
        border-radius: 20px;
        border: 1px solid transparent;
    }

    .stage-button--warning {
        color: #fff;
        background-color: #adb3fb;
        border-color: #9eb0fb;
    }

    .stage-button--small {
        padding: 7px 18px;
        font-size: 12px;
        border-radius: 4px;
    }

    .stage-button {
        display: inline-block;
        line-height: 1;
        white-space: nowrap;
        cursor: pointer;
        border: 1px solid #dcdfe6;
        appearance: none;
        text-align: center;
        outline: none;
        margin: 0;
        transition: .1s;
        user-select: none;
        padding: 10px 24px;
        font-size: 14px;
        border-radius: 4px;
    }

    a {
        text-decoration: none;
    }

    .author-p {
        color: #222222;
    }

    .artwork-modal__sidebar {
        padding: 20px 30px 30px;
        border-top: 1px solid #ececec;
    }

    .artwork-modal__copyright-tips {
        display: flex;
        justify-content: space-between;
        padding-bottom: 20px;
        border-bottom: 1px solid #ececec;
        margin-bottom: 20px;
        font-size: 12px;
        color: #9b9b9b;
    }

    .artwork-modal__created-at {
        padding-right: 10px;
        margin-right: 10px;
        position: relative;
    }

    .artwork-modal__tag-more-artwork-wrapper {
        display: flex;
        -ms-flex: 1;
        flex: 1;
        position: relative;
        flex-direction: column;
        align-items: stretch;
    }

    .stage-flex-container {
        display: flex;
    }

    .stage-flex-container.is-vertical {
        flex-direction: column;
    }

    .artwork-modal__sidebar-title {
        color: #9b9b9b;
        font-size: 14px;
        line-height: 14px;
        margin-bottom: 10px;
    }

    .artwork-modal ul {
        padding-left: 0;
        list-style: none;
    }

    .artwork-modal li {
        display: inline-block;
    }

    .category-tag {
        color: #222222;
        padding: 0px 10px;
        font-size: 12px;
        border: 1px solid #adb3fb;
        border-radius: 40px;
        margin: 5px 5px 5px 5px;
        transition: .5s;
        cursor: pointer;
    }

    /deep/ .el-dialog__headerbtn {
        position: fixed;
        top: 20px;
        right: 40px;
        padding: 0;
        background: 0 0;
        border: none;
        cursor: pointer;
        font-size: 60px;
        color: #222222;
    }

    .works-comment {
        margin-top: 14px;
        padding: 24px 28px;
        background-color: #fff;
        border-radius: 4px;
    }

    .comment-form {
        display: flex;
    }

    .clearfix {
        zoom: 1;
    }

    .comment-btn {
        cursor: pointer;
        width: 116px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        background: #adb3fb;
        border-radius: 0 4px 4px 0;
        color: #2d2d2d;
        font-size: 18px;
    }

    .comment-num {
        font-size: 16px;
        color: #1a1a1a;
        padding: 20px 0;
    }

    .comment-num span {
        color: #999;
        font-size: 14px;
    }

    .comment-li {
        display: flex;
        margin-bottom: 20px;
    }

    .user-avatar {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .c-face-img-con {
        display: inline-block;
        position: relative;
    }

    .c-face-img img {
        width: 100%;
        height: 100%;
    }

    .comment-wrap {
        flex: 1;
        margin-left: 20px;
        border-bottom: 1px solid #eee;
        padding-bottom: 20px;
    }

    .user-name {
        font-weight: 700;
        color: #333;
        font-size: 14px;
    }

    .user-content {
        margin-top: 8px;
        color: #666;
        font-size: 14px;
        word-break: break-all;
    }

    .comment-info {
        padding: 14px 0 0;
        color: #999;
        font-size: 12px;
        display: flex;
    }

    .comment-time {
        flex-grow: 1;
    }

    .like-num {
        cursor: pointer;
        position: relative;
        display: flex;
        align-items: center;
    }

    .like-num span {
        margin-bottom: 2px;
        display: inline-block;
    }

    .artwork-modal__operator {
        position: absolute;
        left: 100%;
        width: 80px;
        height: 80px;
        font-size: 14px;
        background: #fff;
        border-radius: 0 8px 8px 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        line-height: 1;
        color: #9b9b9b;
    }

    .artwork-modal__operator i {
        color: #d8d8d8;
        font-size: 32px;
        margin-bottom: 5px;
    }
</style>

